#ifndef __TCPSERVER_HH__
#define __TCPSERVER_HH__

#include "Acceptor.hh"
#include "EventLoop.hh"
#include <string>
#include <functional>
#include <memory>

using std::string;
using std::function;
using std::shared_ptr;

class TcpServer
{
    using func_ptr=function<void(const shared_ptr<TcpConnection>&)>;
public:
    TcpServer(string ip,  unsigned short port);
    ~TcpServer();
    void Start();
    void Set_callback(const func_ptr& new_, const func_ptr& old_, const func_ptr& close_);
    void Loop();
private:
    Acceptor _acceptor;
    EventLoop _loop;
};


#endif